
import { createApi, fetchBaseQuery } from "@reduxjs/toolkit/dist/query/react";

//入库操作请求API
export const totalGPSApi = createApi({
    reducerPath: 'totalgps',
    //设置基本请求路径
    baseQuery: fetchBaseQuery({
        baseUrl: window.app
    }),
    tagTypes:['totalgps'],//定义标签
    endpoints(build) {
        return {
            //获取入库记录
                    
           
            //修改一条商品入库记录
            posttotalgps: build.mutation({
                query(key) {
                    return {
                        url: `QuartzSupplement/GetTotalTracks?path=${key}`,
                        method: 'POST',
                        // body:data
                    };
                },
                transformResponse(baseQuery){
                    return baseQuery;

                },
                invalidatesTags:['totalgps']//定义标签，一旦修改数据，则会使该标签失效
            }),
            //修改一条商品入库记录
            postdbctotalgps: build.mutation({
                query(key) {
                    return {
                        url: `QuartzSupplement/GetDBCTotalTracks?path=${key}`,
                        method: 'POST',
                        // body:data
                    };
                },
                transformResponse(baseQuery){
                    return baseQuery;

                },
                invalidatesTags:['totalgps']//定义标签，一旦修改数据，则会使该标签失效
            }),
            
        }
    }
});


//导出钩子函数给外部使用，自动生成hooks的名称为`use(Endpoint_name)Query`
export const { usePosttotalgpsMutation, usePostdbctotalgpsMutation } = totalGPSApi;